package com.overseasShopping.Biz.impl;

import java.util.List;

import com.overseasShopping.Base.DAO.GoodsDAO;
import com.overseasShopping.Biz.GoodsBiz;
import com.overseasShopping.pojo.Goods;
import com.overseasShopping.util.PageBean;


public class GoodsBizImpl implements GoodsBiz {

	private GoodsDAO goodsDAO;
	
	public void setGoodsDAO(GoodsDAO goodsDAO) {
		this.goodsDAO = goodsDAO;
	}

	public List<Goods> getAll() {	
		return goodsDAO.getAll();
	}

	public List<Goods> getGoodsByListType(String listType) {
		return goodsDAO.getGoodsByListType(listType);
	}

	public List<Goods> getGoodsByType(int type) {
		return goodsDAO.getGoodsByType(type);
	}

	public List<Goods> getGoodByName(String goodName) {
		return goodsDAO.getGoodByName(goodName);
	}

	public void addGoods(Goods good) {
		goodsDAO.addGoods(good);
	}

	public void getGoodsByListTypePage(String listType, PageBean<Goods> pageBean) {
        goodsDAO.getGoodsByListTypePage(listType, pageBean);
	}

	public void getGoodsByListTypePage(String listType, int type,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType, type, pageBean);
		
	}

	public void getGoodsByPriceUp(String listType, int type,
			PageBean<Goods> pageBean) {
        goodsDAO.getGoodsByPriceUp(listType, type, pageBean);
	}

	public void getGoodsByPriceUp(String listType, PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceUp(listType, pageBean);
	}

	public void getGoodsByPriceDwon(String listType, int type,
			PageBean<Goods> pageBean) {
        goodsDAO.getGoodsByPriceDwon(listType, type, pageBean);
	}

	public void getGoodsByPriceDwon(String listType, PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceDwon(listType, pageBean);
	}

	public void getRecentlyGoods(String listType, int type,
			PageBean<Goods> pageBean) {
		goodsDAO.getRecentlyGoods(listType, type, pageBean);
	}

	public void getRecentlyGoods(String listType, PageBean<Goods> pageBean) {
		goodsDAO.getRecentlyGoods(listType,pageBean);
	}

	public void getGoodsByPriceUp(String listType, int type, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceUp(listType, type, name, pageBean);
		
	}

	public void getGoodsByPriceDwon(String listType, int type, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceDwon(listType, type, name, pageBean);
		
	}

	public void getRecentlyGoods(String listType, int type, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType,type, name, pageBean);
		
	}
	
	public void getRecentlyGoods(String listType,  String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType,name, pageBean);
		
	}

	public void getGoodsByListTypePage(String listType, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType, name, pageBean);
		
	}

	public void getGoodsByListTypePage(String listType, String name, int type,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType, type, name, pageBean);
		
	}

	public void getGoodsByPriceUp(String listType, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceUp(listType, name, pageBean);
		
	}

	public void getGoodsByPriceDwon(String listType, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByPriceDwon(listType, name, pageBean);
	}

	public void getGoodsByListTypePage(String listType, int type, String name,
			PageBean<Goods> pageBean) {
		goodsDAO.getGoodsByListTypePage(listType,type,name,pageBean);
		
	}
	
	public List<Goods> getGoodByUserId(String userId) {
		return goodsDAO.getGoodByUserId(userId);
	}

	public List<Goods> getGoodByUserId(String userId, String listType) {
		return goodsDAO.getGoodByUserId(userId,listType);
	}

	public List<Goods> getGoodByUserId(String userId, String listType, int state) {
		return goodsDAO.getGoodByUserId(userId, listType, state);
	}

	public void fixGoodState(String userid, String goodName, float price) {
		Goods good = (Goods) goodsDAO.getGoodByUserId(userid, goodName);
		good.setPrice(price);
		goodsDAO.save(good);
	}
	
	public void fixGoodState(String userId,String goodName, int state) {
		Goods good = (Goods) goodsDAO.getGoodByUserId(userId, goodName);
		good.setState(state);
		goodsDAO.save(good);
	}
	public void fixGoodState(String goodId, int state) {
		Goods good = goodsDAO.getGoodBygoodId(goodId);
		good.setState(state);
		goodsDAO.save(good);
	}

	public Goods getGoodBygoodId(String goodId) {
		return goodsDAO.get(goodId);
	}

	public void updateGoods(Goods good) {	
		goodsDAO.update(good);		
	}

	public List<Goods> getHotGoods() {
		return goodsDAO.getHotGoods();
	}
	

}
